 $(document).ready(function(){
   $("table thead th[colType='data'] div.thOpContainer .databutton").click(function(e){
     clickEvent();
   });
   $("table thead th[colType='data'] div.thOpContainer input.dataBox").each(function(i,e){
     var th = findUpElement(e,"th[colType='data']");
     var fieldName = $(th).attr("fieldname");
     var originUrl = window.location.search;
     var regStr = eval("/q-"+ fieldName +"=([^&]+)/i");
     if(originUrl.match(regStr)){
       $(e).attr("value", decodeURI(originUrl.match(regStr)[1]));
     }
   });
      
   function clickEvent(){
     var dataBoxs = $("table thead th[colType='data'] div.thOpContainer div.query input.dataBox[type='text']");
     var originUrl = document.baseURI;
     originUrl = originUrl.replace(/&start=[\d]+/i, "");
     originUrl = originUrl.replace(/start=[\d]+&/i, "");
     dataBoxs.each(function(i,e){
       var th = findUpElement(e,"th[colType='data']");
       var fieldName = $(th).attr("fieldname");
       var queryString = $(e).attr("value");
       originUrl = originUrl.replace(eval("/&q-"+ fieldName +"=[^&]+/i"), "");
       originUrl = originUrl.replace(eval("/&q-"+ fieldName +"=[^&]&+/i"), "");
       if(fieldName && queryString){
         console.log(fieldName + ":" + queryString);
         originUrl = originUrl + "&q-" + fieldName + "=" + queryString;
       }
     });
     window.location.href = (originUrl);
   }
   $("table thead th div.thOpContainerTitle").click(
       function(e){
         $("div.thOpContainer").slideToggle("fast");
       });
 });
 